<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>特征工程 - AI 中心</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        .nav-pills .nav-link.active {
            background-color: #0d6efd;
        }
        .feature-card {
            transition: transform 0.2s;
        }
        .feature-card:hover {
            transform: translateY(-5px);
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="#">特征工程</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="../index.html">返回 AI 中心</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container-fluid">
        <div class="row">
            <!-- 左侧导航 -->
            <div class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
                <div class="position-sticky pt-3">
                    <ul class="nav flex-column nav-pills">
                        <li class="nav-item">
                            <a class="nav-link active" href="#feature-selector" data-bs-toggle="pill">
                                <i class="bi bi-list-check me-2"></i>特征选择器
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#feature-transformation" data-bs-toggle="pill">
                                <i class="bi bi-arrow-repeat me-2"></i>特征转换
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#feature-version" data-bs-toggle="pill">
                                <i class="bi bi-clock-history me-2"></i>特征版本
                            </a>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- 右侧内容 -->
            <div class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
                <div class="tab-content">
                    <!-- 特征选择器 -->
                    <div class="tab-pane fade show active" id="feature-selector">
                        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                            <h1 class="h2">特征选择器</h1>
                            <div>
                                <button class="btn btn-outline-primary me-2">
                                    <i class="bi bi-upload"></i> 导入特征
                                </button>
                                <button class="btn btn-primary">
                                    <i class="bi bi-save"></i> 保存选择
                                </button>
                            </div>
                        </div>

                        <div class="row">
                            <!-- 可用特征列表 -->
                            <div class="col-md-4">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">可用特征</h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="list-group">
                                            <label class="list-group-item">
                                                <input class="form-check-input me-1" type="checkbox" value="">
                                                温度 (temperature)
                                            </label>
                                            <label class="list-group-item">
                                                <input class="form-check-input me-1" type="checkbox" value="">
                                                湿度 (humidity)
                                            </label>
                                            <label class="list-group-item">
                                                <input class="form-check-input me-1" type="checkbox" value="">
                                                压力 (pressure)
                                            </label>
                                            <label class="list-group-item">
                                                <input class="form-check-input me-1" type="checkbox" value="">
                                                振动 (vibration)
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!-- 特征重要性 -->
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">特征重要性分析</h5>
                                    </div>
                                    <div class="card-body">
                                        <canvas id="featureImportanceChart" height="300"></canvas>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 特征转换 -->
                    <div class="tab-pane fade" id="feature-transformation">
                        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                            <h1 class="h2">特征转换</h1>
                            <button class="btn btn-primary">
                                <i class="bi bi-plus-lg"></i> 添加转换
                            </button>
                        </div>

                        <div class="row">
                            <!-- 转换规则列表 -->
                            <div class="col-md-4">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">转换规则</h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="list-group">
                                            <div class="list-group-item">
                                                <div class="d-flex w-100 justify-content-between">
                                                    <h6 class="mb-1">温度标准化</h6>
                                                    <small>Z-score</small>
                                                </div>
                                                <p class="mb-1">对温度数据进行标准化处理</p>
                                            </div>
                                            <div class="list-group-item">
                                                <div class="d-flex w-100 justify-content-between">
                                                    <h6 class="mb-1">湿度归一化</h6>
                                                    <small>Min-Max</small>
                                                </div>
                                                <p class="mb-1">将湿度值归一化到[0,1]区间</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!-- 转换预览 -->
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">转换预览</h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table table-sm">
                                                <thead>
                                                    <tr>
                                                        <th>原始值</th>
                                                        <th>转换后</th>
                                                        <th>转换规则</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>25.6</td>
                                                        <td>0.5</td>
                                                        <td>温度标准化</td>
                                                    </tr>
                                                    <tr>
                                                        <td>65.3</td>
                                                        <td>0.8</td>
                                                        <td>湿度归一化</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 特征版本 -->
                    <div class="tab-pane fade" id="feature-version">
                        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                            <h1 class="h2">特征版本管理</h1>
                            <button class="btn btn-primary">
                                <i class="bi bi-plus-lg"></i> 创建版本
                            </button>
                        </div>

                        <div class="row">
                            <!-- 版本列表 -->
                            <div class="col-md-4">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">版本历史</h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="list-group">
                                            <a href="#" class="list-group-item list-group-item-action active">
                                                <div class="d-flex w-100 justify-content-between">
                                                    <h6 class="mb-1">v1.2.0</h6>
                                                    <small>3天前</small>
                                                </div>
                                                <p class="mb-1">添加振动特征</p>
                                            </a>
                                            <a href="#" class="list-group-item list-group-item-action">
                                                <div class="d-flex w-100 justify-content-between">
                                                    <h6 class="mb-1">v1.1.0</h6>
                                                    <small>1周前</small>
                                                </div>
                                                <p class="mb-1">优化温度特征</p>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!-- 版本详情 -->
                            <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">版本详情</h5>
                                    </div>
                                    <div class="card-body">
                                        <h6>特征列表</h6>
                                        <ul class="list-group mb-3">
                                            <li class="list-group-item d-flex justify-content-between align-items-center">
                                                温度
                                                <span class="badge bg-primary rounded-pill">标准化</span>
                                            </li>
                                            <li class="list-group-item d-flex justify-content-between align-items-center">
                                                湿度
                                                <span class="badge bg-primary rounded-pill">归一化</span>
                                            </li>
                                            <li class="list-group-item d-flex justify-content-between align-items-center">
                                                振动
                                                <span class="badge bg-primary rounded-pill">原始值</span>
                                            </li>
                                        </ul>

                                        <h6>版本说明</h6>
                                        <p>添加了振动传感器数据作为新特征，用于提高预测准确性。</p>

                                        <h6>性能指标</h6>
                                        <div class="table-responsive">
                                            <table class="table table-sm">
                                                <thead>
                                                    <tr>
                                                        <th>指标</th>
                                                        <th>值</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>特征数量</td>
                                                        <td>3</td>
                                                    </tr>
                                                    <tr>
                                                        <td>特征维度</td>
                                                        <td>5</td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script>
        // 特征重要性图表
        const ctx = document.getElementById('featureImportanceChart').getContext('2d');
        new Chart(ctx, {
            type: 'bar',
            data: {
                labels: ['温度', '湿度', '压力', '振动'],
                datasets: [{
                    label: '特征重要性',
                    data: [0.4, 0.3, 0.2, 0.1],
                    backgroundColor: [
                        'rgba(54, 162, 235, 0.5)',
                        'rgba(75, 192, 192, 0.5)',
                        'rgba(153, 102, 255, 0.5)',
                        'rgba(255, 159, 64, 0.5)'
                    ],
                    borderColor: [
                        'rgba(54, 162, 235, 1)',
                        'rgba(75, 192, 192, 1)',
                        'rgba(153, 102, 255, 1)',
                        'rgba(255, 159, 64, 1)'
                    ],
                    borderWidth: 1
                }]
            },
            options: {
                scales: {
                    y: {
                        beginAtZero: true,
                        max: 1
                    }
                }
            }
        });
    </script>
</body>
</html> 